package com.xiaochong.tir.api.thread;

import com.xc.logclient.utils.LogTrace;
import com.xiaochong.tir.api.service.WebSocketService;
import com.xiaochong.tir.api.util.SpringContextUtil;

import java.util.List;
import java.util.concurrent.CountDownLatch;

/**
 * @Description: java类作用描述
 * @Author: org
 * @CreateDate: 2018/8/22 13:44
 */
public class KLineActionOfTwoDayThread implements Runnable{

    private List<String> dataOfdate;
    private CountDownLatch countDownLatch;
    private String kDate;
    private Integer exchangeId;
    private String transactionName;

    private WebSocketService webSocketService =
            (WebSocketService) SpringContextUtil.getBean("webSocketService");
    @Override
    public void run() {
        LogTrace.beginTrace("根据日期获取当天数据Theard");
        try {
            //查询某一天的数据
            dataOfdate = webSocketService.getKActionOfDate(kDate,exchangeId,transactionName,dataOfdate);
        }catch (Exception e){
            e.printStackTrace();
            LogTrace.error("根据日期获取当天数据Error",e);
        }finally {
            countDownLatch.countDown();
        }
    }

    public List<String> getDataOfdate() {
        return dataOfdate;
    }

    public void setDataOfdate(List<String> dataOfdate) {
        this.dataOfdate = dataOfdate;
    }

    public CountDownLatch getCountDownLatch() {
        return countDownLatch;
    }

    public void setCountDownLatch(CountDownLatch countDownLatch) {
        this.countDownLatch = countDownLatch;
    }

    public String getkDate() {
        return kDate;
    }

    public void setkDate(String kDate) {
        this.kDate = kDate;
    }

    public Integer getExchangeId() {
        return exchangeId;
    }

    public void setExchangeId(Integer exchangeId) {
        this.exchangeId = exchangeId;
    }

    public String getTransactionName() {
        return transactionName;
    }

    public void setTransactionName(String transactionName) {
        this.transactionName = transactionName;
    }

    public KLineActionOfTwoDayThread(List<String> dataOfdate, CountDownLatch countDownLatch, String kDate, Integer exchangeId, String transactionName) {
        this.dataOfdate = dataOfdate;
        this.countDownLatch = countDownLatch;
        this.kDate = kDate;
        this.exchangeId = exchangeId;
        this.transactionName = transactionName;
    }
}
